#include "ustandard/ustandard_sys.h"
#define usec_sleep  (5*1000)
int ktimes = 0;
int xusleep(int usec)
{
    ktimes ++; 
    usleep(usec);
    return 0;
}
int main()
{
    struct timeval tv1;
    struct timeval tv2;
    int total_times = (1000000 / usec_sleep);
    gettimeofday(&tv1, NULL);

    while(1) {
        static int ktimes_xwkdfjd = 0;
        if(ktimes_xwkdfjd ++ >= total_times) {
            break;
        }

        xusleep(usec_sleep);
    }
    gettimeofday(&tv2, NULL);

    double sec = (double)(tv2.tv_sec - tv1.tv_sec) + 
            (double)(tv2.tv_usec - tv1.tv_usec)/1e6;
    printf("sec=%lf\n", sec);


    printf("ktimes=%d\n", ktimes);


    return 0;
}
